(function (window, undefined) {
	var ehy=new Object();
	ehy.isLogin=false;
	
	ehy.member=function(){
		var url="member/front/isLogin.action";
		var data={"intercept":true};
		$.post(url,data,function(flag){
			ehy.isLogin=flag;
			var url=ehy.topWin.location.href;
			if(url.indexOf("pages/front/info.jsp")==-1 && !flag){
				ehy.topWin.location.href="pages/front/login.jsp";
			}
		},"json");
	};
	ehy.topWin= (function (p,c){
	    while(p!=c){
	        c = p;        
	        p = p.parent;
	    }
	    return c;
	})(window.parent,window);
	
	ehy.manager=function(){
		var url="manager/back/isLogin.action";
		var data={"intercept":true};
		$.post(url,data,function(flag){
			if(!flag){
				ehy.topWin.location.href="pages/back/login.jsp";
			}
		},"json");
	};
	window.ehy=ehy;
})(window);


$(function(){
	var url=window.location.href;
	if(url.indexOf("back")>-1){
		ehy.manager();
	}else{
		ehy.member();
	}
});

Date.prototype.format = function(fmt) { 
    var o = { 
       "M+" : this.getMonth()+1,                 
       "d+" : this.getDate(),                   
       "h+" : this.getHours(),                   
       "m+" : this.getMinutes(),                 
       "s+" : this.getSeconds(),                 
       "q+" : Math.floor((this.getMonth()+3)/3), 
       "S"  : this.getMilliseconds()
   }; 
   if(/(y+)/.test(fmt)) {
           fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
   }
    for(var k in o) {
       if(new RegExp("("+ k +")").test(fmt)){
            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
        }
    }
   return fmt; 
}   
